package com.example.demo.utils.result;

public class ResultUtils {
    private static final int SUCCESS_CODE = 20000;
    private static final String SUCCESS_MESSAGE = "Success!";

    private static final int FAILED_CODE = 50008;
    private static final String FAILED_MESSAGE = "Failed!";


    public static<T> Result<T> success(T obj){
        return new Result<T>(SUCCESS_CODE, SUCCESS_MESSAGE, obj);
    }

    public static<T> Result<T> failed(T obj){
        return new Result<>(FAILED_CODE, FAILED_MESSAGE, obj);
    }

    public static<T> Result<T> failed(String message){
        return new Result<>(FAILED_CODE, message, null);
    }

    public static<T> Result<T> failed(T obj, String message){
        return new Result<>(FAILED_CODE, message, obj);
    }

}
